/*
* @Title: 通用设置
* @Created by: emiya
*/
<template>
	<view class="box">
		<IndexHead :config="navConfig" />
		<view class="mainback">
			<view class="man" v-for="setmain in listdata" @tap="jump(setmain)" :key="setmain.id">
				<view>{{setmain.title}}</view>
				<view>
					<switch v-if="setmain.id==1||setmain.id==2" color="#74C146" @change="switch2Change" />
					<uni-icon v-if="setmain.id==0" type="arrowright" size="20"></uni-icon>
				</view>
			</view>
		</view>
		<view class="mainback padd">
			<view class="man" v-for="setmain in listb" @tap="jump(setmain)" :key="setmain.id">
				<view>{{setmain.title}}</view>
				<view>
					<uni-icon type="arrowright" size="20"></uni-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcon from "@/components/uni-icon/uni-icon.vue"
	export default {
		components: {
			uniIcon
		},
		data() {
			return {
				navConfig: {
					backgroundColor: 'transparent',
					color: '#fff',
					common: {
						hasSearch: false,
						hasMenu: false,
						hasTitle: true,
						minHead: true,
					},
					left: {
						img: '',
						text: '',
					},
					mid: {
						title: '通用',
						hasSearchMid: false
					},
				},
				listdata: [{
					id: 0,
					title: "开启位置服务",
					url: ""
				}, {
					id: 1,
					title: "WIFI下自动播放视频",
					url: ""
				}, {
					id: 2,
					title: "截图后提示分享",
					url: ""
				}],
				listb: [{
					id: 3,
					title: "多语言",
					url: ""
				}, {
					id: 4,
					title: "清除缓存",
					url: ""
				}]

			}
		},
		methods: {
			jump(setmain) {
				uni.navigateTo({
					url: setmain.url
				})
				if(setmain.id==4){
					uni.showModal({
					    title: '',
					    content: '是否清除缓存',
					    success: function (res) {
					        if (res.confirm) {
					            console.log('用户点击确定');
					        } else if (res.cancel) {
					            console.log('用户点击取消');
					        }
					    }
					});
				}
			}
		},
	}
</script>

<style scoped>
	* {
		margin: 0;
		padding: 0;
	}

	.no-menu {
		margin-bottom: 0px;
	}

	.box {
		background-color: #F6F6F6;
		height: 100vh;
		font-size: 34upx;
	}

	.mainback {
		background: #FFFFFF;
		margin-top: -20upx;
	}

	.man {
		display: flex;
		justify-content: space-between;
		width: 90%;
		margin: auto;
		padding: 30upx 0upx;
		border-bottom: 1px solid #EEEEEE;
		font-size: 26upx;
	}

	.mainback .man:last-child {
		border-bottom: 0upx solid #FFFFFF !important;
	}

	.setimga {
		width: 30upx;
		height: 50upx;
	}

	.padd {
		margin-top: 25upx;
	}

	.setbun {
		width: 100%;
		background-color: #FFFFFF;
		text-align: center;
		margin-top: 20upx;
		padding: 25upx 0px;
	}
</style>
